package command
{
	import com.adobe.cairngorm.commands.ICommand;
	import com.adobe.cairngorm.control.CairngormEvent;
	import com.adobe.cairngorm.control.CairngormEventDispatcher;
	
	import event.LoadWhoDataEvent;
	
	import model.BabyChartModelLocator;
	
	import mx.rpc.IResponder;

	public class AppInitializationCommand implements IResponder, ICommand
	{
		private var babyChartModel:BabyChartModelLocator = BabyChartModelLocator.getInstance();
		
		public function result(data:Object):void
		{
		}
		
		public function fault(info:Object):void
		{
			//TODO: implement function
		}
		
		public function execute(event:CairngormEvent):void
		{
			if (babyChartModel.baby == null) {
				babyChartModel.getNewBaby();
			}
			var chartType:String = babyChartModel.getChartType();
			if (babyChartModel.getList(chartType) == null) {
				CairngormEventDispatcher.getInstance().dispatchEvent(new LoadWhoDataEvent(chartType));
			}

		}
		
	}
}